package map;

import exception.MapDefineExcepiton;
import exception.MapOverRangeDefineExcepiton;

/**
 * 全局地图大小
 * @author lijia
 *
 */
public class GMap {

	private int width;
	private int height;
	private static final int DEFAULT_WIDTH = 1000;
	private static final int DEFAULT_HEIGHT = 1000;
	private int[][] pixed;
	
	public GMap() {
		this.width = DEFAULT_WIDTH;
		this.height = DEFAULT_HEIGHT;
		this.pixed = new int[DEFAULT_WIDTH][DEFAULT_HEIGHT];
	}
	
	public GMap(GMapType type) {
		switch (type) {
		case SCHOOL:
			System.out.println("房间选择 学校 地图");
			break;
		case BEACH:
			System.out.println("房间选择 海滩 地图");
			break;
		case DESERT:
			System.out.println("房间选择 沙漠 地图");
			break;
		default:
			break;
		}
 		this.width = DEFAULT_WIDTH;
		this.height = DEFAULT_HEIGHT;
		this.pixed = new int[DEFAULT_WIDTH][DEFAULT_HEIGHT];
	}
	
	public int getWidth() {
		return width;
	}
	
	public void setWidth(int width) {
		this.width = width;
	}
	
	public int getHeight() {
		return height;
	}
	
	public void setHeight(int height) {
		this.height = height;
	}
	
	//获取全局像素
	public int[][] getAllPixed() {
		return this.pixed;
	}
	
	//返回一个像素点的值
	public int getPixed(int x, int y) {
		return this.pixed[x][y];
	}
	
	public void setPixed(int x,int y, int value) {
		if(x<0 || y<0 || x>this.width || y>this.height) {
			throw new MapOverRangeDefineExcepiton();
		}
		this.pixed[x][y] = value;
	}
	
	public static GMap getMap(GMapType type) {
		return new GMap(type);
	}
	
	public void render() {
		
	}
}
